const express = require('express');
const router = express.Router();
const { pool } = require('../config/database');

// Get menu list
router.get('/', async (req, res) => {
  try {
    res.json({
      success: true,
      data: [
        {
          id: 1,
          name: 'Korean Fried Chicken',
          price: 28.00,
          category: 'Main Course',
          description: 'Crispy and delicious Korean fried chicken',
          image: '/images/chicken.jpg'
        },
        {
          id: 2,
          name: 'Stone Bowl Bibimbap',
          price: 25.00,
          category: 'Main Course',
          description: 'Nutritious stone bowl bibimbap',
          image: '/images/bibimbap.jpg'
        }
      ]
    });
  } catch (error) {
    console.error('Get menu error:', error);
    res.status(500).json({
      success: false,
      message: 'Failed to get menu'
    });
  }
});

// Get menu item details
router.get('/:id', async (req, res) => {
  try {
    const { id } = req.params;
    
    res.json({
      success: true,
      data: {
        id: parseInt(id),
        name: 'Korean Fried Chicken',
        price: 28.00,
        category: 'Main Course',
        description: 'Crispy and delicious Korean fried chicken',
        image: '/images/chicken.jpg'
      }
    });
  } catch (error) {
    console.error('Get menu item error:', error);
    res.status(500).json({
      success: false,
      message: 'Failed to get menu item details'
    });
  }
});

module.exports = router;